How do I programatically specify the "Start in" option for the task to run (/TR) when creating a Scheduled Task (SCHTASKS /CREATE)?
I am programatically building a SCHTASKS /Create command and cannot for the life of me figure out how to specify the "Start in" option. I need this as I am wanting to execute a Java (.jar) app which is in an app directory (as are related and dependent documents/files) but the Java executable is in the program files directory. As can be seen by my command below, I am able to specify the task to run (/tr) and optional arguments, but I have been unsuccessful in figuring out how to set the "Start in" directory. Here is my command thus far: schtasks /create /sc weekly /tn "DataRobot Contact" /TR "C:\Program Files\Java\jre6\bin\javaw.exe -jar DataRobot.jar" /sd 08/27/2011 /mo 1 /F The task I see that if I were to create the task using and XML import I can specify the working directory. So how pray-tell, do I feed that same parameter to SCHTASKS? Regards
June 3rd, 2011 11:38pm

113 views and no replies? Wow!
Free Windows Admin Tool Kit Click here and download it now
June 7th, 2011 2:12pm

Hi, Sorry for the delay! Based on my research, Schtasks from Windows Vista/2008 does not provide a command option that would allow you to specify a "start-in" directory directly. As workaround: 1. Use the /v1 flag to create a XP / 2003 compatible task, "start-in" directory is automatically set as program folder by default. Then, manually change task. 2. Create task from XML file. The XML file allows you specify a "start-in" directory.. 3. Manually create task from UI. According the issue, you may try the first workaround. Should you have further question for this problem, don’t hesitate let me know. Hope that helps Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
June 8th, 2011 9:43pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics